package com.lr.task;

import com.lr.mapper.GRMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Set;


@Component
public class MyTask {
	@Autowired
	private GRMapper grMapper;
	@Autowired
	private RedisTemplate redisTemplate;
	
	@Scheduled(cron= "0 0 0 * * ?")
	public void task1() {
		Set<String> set=redisTemplate.keys("Resume*");
		for(String str:set) {
			grMapper.upResumeBo(Integer.parseInt(str.substring(6)), redisTemplate.opsForSet().size(str).intValue());
			redisTemplate.delete(str);
		}
		Set<String> keys=redisTemplate.keys("*");
		for (String str: keys){
			redisTemplate.delete(str);
		}
	}
}
